<?php
$this->pageTitle = 'Zoznam používateľov';
?>
<div class="listing">
	<h3>Zoznam používateľov</h3>
	<table class="list">
		<thead>
			<tr>
				<th class="identifier"><?php echo $this->Paginator->sort('id', 'ID');?></th>
				<th><?php echo $this->Paginator->sort('username', 'Prihlasovacie meno');?></th>
				<th><?php echo $this->Paginator->sort('fk_person_id', 'Osoba');?></th>
				<th class="action"><?php echo 'Akcie';?></th>
			</tr>
		</thead>
		<tbody>
			<?php
			foreach ($users as $user):
			?>
			<tr>
				<td class="number">
					<?php echo $user['User']['id']; ?>
				</td>
				<td>
					<?php echo htmlspecialchars($user['User']['username']); ?>
				</td>
				<td>
					<?php echo htmlspecialchars($user['Person']['full_name']); ?>
				</td>
				<td>
					<?php
						if (isset($userPermissions['user']['view'])) {
							echo $this->Html->link(__('View', true), array('action' => 'view', $user['User']['id']), array('class' => 'show'));
						}
					?>
					<?php
						if (isset($userPermissions['user']['edit'])) {
							echo $this->Html->link(__('Uprav', true), array('action' => 'edit', $user['User']['id']), array('class' => 'edit'));
						}
					?>
					<?php
						if (isset($userPermissions['user']['delete'])) {
							echo $this->Html->link(__('Delete', true), array('action' => 'delete', $user['User']['id']), array('class' => 'delete'), __('Ste si istý, že chcete odstrániť záznam?', true));
						}
					?>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>

	<?php if ($this->Paginator->hasPage(2)): ?>
		<div class="pager">
			<?php echo $this->Paginator->prev('<< '.__('predchádzajúca', true), array(), null, array('class'=>'disabled')); ?>
			<?php echo $this->Paginator->numbers(); ?>
			<?php echo $this->Paginator->next(__('ďalšia', true).' >>', array(), null, array('class' => 'disabled')); ?>
		</div>
	<?php endif; ?>
</div>